namespace Jumpton.SFA.Server.Entity
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;


    [System.SerializableAttribute()]
    [Map("ORDER_LINES")]
    public class ORDER_LINES : ObjectRow
    {

        public ORDER_LINES()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public ORDER_LINES(System.Data.DataRow dataRow, ObjectTable parent) :
            base(dataRow, parent)
        {
        }

        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ORDER_LINES(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
            base(info, context)
        {
        }

        [Key("ID", true, true)]
        public decimal ID
        {
            get
            {
                return (System.Decimal)GetValue("ID");
            }
            set
            {
                SetValue("ID", value);
            }
        }

        [Field("ORDER_NO")]
        public string ORDERNO
        {
            get
            {
                return (System.String)GetValue("ORDERNO");
            }
            set
            {
                SetValue("ORDERNO", value);
            }
        }

        [Field("PRODUCT_ID")]
        public int PRODUCTID
        {
            get
            {
                return (System.Int32)GetValue("PRODUCTID");
            }
            set
            {
                SetValue("PRODUCTID", value);
            }
        }

        [Field("UOM_CODE")]
        public string UOMCODE
        {
            get
            {
                return (System.String)GetValue("UOMCODE");
            }
            set
            {
                SetValue("UOMCODE", value);
            }
        }

        [Field("PRODUCT_CODE")]
        public string PRODUCTCODE
        {
            get
            {
                return (System.String)GetValue("PRODUCTCODE");
            }
            set
            {
                SetValue("PRODUCTCODE", value);
            }
        }

        [Field("QUANTITY_ORDERED")]
        public decimal QUANTITYORDERED
        {
            get
            {
                return (System.Decimal)GetValue("QUANTITYORDERED");
            }
            set
            {
                SetValue("QUANTITYORDERED", value);
            }
        }

        [Field("QUANTITY_SHIPPED")]
        public decimal QUANTITYSHIPPED
        {
            get
            {
                return (System.Decimal)GetValue("QUANTITYSHIPPED");
            }
            set
            {
                SetValue("QUANTITYSHIPPED", value);
            }
        }

        [Field("LINE_AMOUNT")]
        public decimal LINEAMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("LINEAMOUNT");
            }
            set
            {
                SetValue("LINEAMOUNT", value);
            }
        }

        [Field("LINE_DISC_RATE")]
        public decimal LINEDISCRATE
        {
            get
            {
                return (System.Decimal)GetValue("LINEDISCRATE");
            }
            set
            {
                SetValue("LINEDISCRATE", value);
            }
        }

        [Field("LINE_DISC_AMOUNT")]
        public decimal LINEDISCAMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("LINEDISCAMOUNT");
            }
            set
            {
                SetValue("LINEDISCAMOUNT", value);
            }
        }

        [Field("SKU_DISC_RATE")]
        public decimal SKUDISCRATE
        {
            get
            {
                return (System.Decimal)GetValue("SKUDISCRATE");
            }
            set
            {
                SetValue("SKUDISCRATE", value);
            }
        }

        [Field("SKU_DISC_AMOUNT")]
        public decimal SKUDISCAMOUNT
        {
            get
            {
                return (System.Decimal)GetValue("SKUDISCAMOUNT");
            }
            set
            {
                SetValue("SKUDISCAMOUNT", value);
            }
        }

        [Field("DOMAIN_ID")]
        public decimal DOMAINID
        {
            get
            {
                return (System.Decimal)GetValue("DOMAINID");
            }
            set
            {
                SetValue("DOMAINID", value);
            }
        }

        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get
            {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set
            {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public Decimal LAST_UPDATE_TIME
        {
            get
            {
                return (Decimal)GetValue("LAST_UPDATE_TIME", DateTime.Now);
            }
            set
            {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

   

        [Field("CANCELLED")]
        public string CANCELLED
        {
            get
            {
                return (System.String)GetValue("CANCELLED");
            }
            set
            {
                SetValue("CANCELLED", value);
            }
        }

        [Field("FREE_PRODUCTS")]
        public int FREEPRODUCTS
        {
            get
            {
                return (System.Int32)GetValue("FREEPRODUCTS");
            }
            set
            {
                SetValue("FREEPRODUCTS", value);
            }
        }

        [Field("DISC_1")]
        public decimal DISC1
        {
            get
            {
                return (System.Decimal)GetValue("DISC1");
            }
            set
            {
                SetValue("DISC1", value);
            }
        }

        [Field("DISC_2")]
        public decimal DISC2
        {
            get
            {
                return (System.Decimal)GetValue("DISC2");
            }
            set
            {
                SetValue("DISC2", value);
            }
        }

        [Field("Quantity_Received")]
        public decimal QuantityReceived
        {
            get
            {
                return (System.Decimal)GetValue("QuantityReceived");
            }
            set
            {
                SetValue("QuantityReceived", value);
            }
        }
        [Field("Confirmed_Date")]
        public decimal Confirmed_Date
        {
            get
            {
                return (System.Decimal)GetValue("Confirmed_Date");
            }
            set
            {
                SetValue("Confirmed_Date", value);
            }
        }
        [Field("Confirm_user_code")]
        public string Confirm_user_code
        {
            get
            {
                return (System.String)GetValue("Confirm_user_code");
            }
            set
            {
                SetValue("Confirm_user_code", value);
            }
        }
        [Field("ARRIVAL_date")]
        public decimal ARRIVAL_date
        {
            get
            {
                try
                {
                    return (System.Decimal)GetValue("ARRIVAL_date");
                }catch{
                    return 0;
                    }
            }
            set
            {
                SetValue("ARRIVAL_date", value);
            }
        }

        [Field("OrderLineStatus")]
        public decimal OrderLineStatus
        {
            get
            {
                return (System.Decimal)GetValue("OrderLineStatus");
            }
            set
            {
                SetValue("OrderLineStatus", value);
            }
        }

        [Field("OWN_PRO_ID")]
        public int OWNPROID
        {
            get
            {
                return (System.Int32)GetValue("OWNPROID");
            }
            set
            {
                SetValue("OWNPROID", value);
            }
        }

        [Field("PROMOTION_ID")]
        public decimal PROMOTIONID
        {
            get
            {
                return (System.Decimal)GetValue("PROMOTIONID");
            }
            set
            {
                SetValue("PROMOTIONID", value);
            }
        }

        [Field("ABNORMITY_TYPE")]
        public int ABNORMITY_TYPE
        {
            get
            {
                return (System.Int32)GetValue("ABNORMITY_TYPE");
            }
            set
            {
                SetValue("ABNORMITY_TYPE", value);
            }
        }

        public static string GetOrderLineStatus(int type)
        {
            EOrderLineStatus status = (EOrderLineStatus)Enum.Parse(typeof(EOrderLineStatus), type.ToString());
            if (status == null)
                return "未知";
            return status.ToString();
        }

    }

    public enum EOrderLineStatus
    {
        已确认 =2,
        未确认 = 0,
        部分确认=20,
        已取消 = 1,
        已发货=5,
        部分发货=50,
        已制作=3,
        部份已制作=30,
        已完成=4,
        部份已完成=40
		
        
    }
}
